<template>
  <view class="sku-table">
    <view class="sku-title">
      <text>{{ data.key }}</text>
    </view>
    <table>
      <thead>
        <tr>
          <th>规格选项</th>
          <th>价格(元)</th>
          <th>库存</th>
        </tr>
      </thead>
      <tbody>
        <tr v-for="(item,index) in data.values" :key="index">
          <td>{{ item.spec }}</td>
          <td>{{ item.price }}</td>
          <td>{{ item.stock===null?'不限':item.stock }}</td>
        </tr>
      </tbody>
    </table>
  </view>
</template>

<script>
export default {
  props: {
    data: {
      type: Object,
      default() {
        return {
          key: "",
          values: []
        };
      }
    }
  },
  data() {
    return {};
  }
};
</script>

<style scoped lang="scss">
.sku-table {
  width: 80%;
  margin: 0 auto;
  .sku-title {
    color: $uni-text-color-grey;
    font-size: $uni-font-size-lg;
  }
  table {
    color: $uni-text-color-grey;
    font-size: $uni-font-size-base;
    width: 100%;
  }
}
</style>
